package com.indusfo.spc.client.service.impl;

import com.indusfo.spc.client.mapper.ClientOrderMapper;
import com.indusfo.spc.client.service.ClientOrderService;
import com.indusfo.spc.pojo.Order;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author chenm
 * @create 2019-12-09 19:38
 */
@Service
public class ClientOrderServiceImpl implements ClientOrderService {

  @Resource
  private ClientOrderMapper clientOrderMapper;

  @Override
  public JSONObject selectList(Order order) {
    Integer pagesize = order.getPagesize();
    Integer pageindex = order.getPageindex();
    if (pagesize != null && pageindex != null) {
      order.setIncept(pagesize * (pageindex - 1));
    }
    List<Order> orders = clientOrderMapper.selectList(order);
    int count = clientOrderMapper.selectCount(order);
    return JSONObject.oK("查询成功",orders,count);
  }

}
